<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="{{url_for('static',filename='js/jquery-3.6.1.js')}}" type="text/javascript" charset="utf-8"></script>
    <script src="{{url_for('static',filename='js/02Summit.js')}}" type="text/javascript" charset="utf-8"></script>

</head>
<body>
<script type="text/javascript">
                function Summit(num) {
                    var btn = document.getElementById("Summit");
                    //var int = setInterval(function () {
                    btn.addEventListener('click',function(){
                        //$("#Summit").on("click",function(event){
                        var input = document.getElementsByTagName("input");
                        //console.log(input.length);
                        var a;
                        var b;
                        var c=["MV","AV","VF"];
                        var d={};
                        var e;
                        var f={};
                        var g=[];
                        //console.log(num);
                        for (var i=num;i<input.length ;i++ )
                        {
                            //if(input[i].type=="checkbox")
                            if(input[i].checked==true){
                                //console.log(i);
                                a="COM"+(Math.floor((i-num)/(num*3))+1);
                                //console.log(a);
                                b=(i-num)%(num*3)+1;
                                //console.log(b);
                                e="ID"+(Math.floor((b-1)/3)+1);
                                console.log(e);
                                //console.log(((b-1)%3+1))
                                g[b-(Math.floor((b-1)/3))*3-1]=c[((b-1)%3)];
                                d[e]=g;
                                f[a]=d;
                            }
                        }

                        $.ajax(
                                   {

                                       url:"/corrosion/multiplicityshowdata", //从setData函数中获取数据
                                       type:"post",
                                       dateType:'json',
                                       //contentType : "application/json;charset=UTF-8",
                                       data:JSON.stringify(f),
                                       //dataType: "text",
                                        success:function(ret){
                                        }

                                   }
                        );
                        window.location.href='{{url_for('a03')}}';
                    },false);
                    //},1000)
                }

        function toSelect(b,name){
            //var input = document.getElementsByTagName("input");
            var input = document.getElementsByName(name);
            //console.log(input.length);
            for (var i=0;i<input.length ;i++ )
            {
                if(input[i].type=="checkbox")
                    input[i].checked = b;
            }
        }

        function toSelect1(b){

            var input = document.getElementsByName("cb1");
            console.log(input.length);
            for (var i=0;i<input.length ;i++ )
            {
                if(input[i].type=="checkbox")
                    input[i].checked = b;
            }
        }

        function toSelect2(b){

            var input = document.getElementsByName("cb2");
            console.log(input.length);
            for (var i=0;i<input.length ;i++ )
            {
                if(input[i].type=="checkbox")
                    input[i].checked = b;
            }
        }

            $(function () {
                    //var int = setInterval(function () {  //设置定时器

                       $.ajax(
                           {
                               url:"/corrosion/speedchoicedata", //从setData函数中获取数据
                               type:"get",
                               dateType:'json',
                                success:function(ret){
                                    var newData = JSON.stringify(ret);
                                    newData = eval("("+newData+")");
                                    /*console.log(newData["COM1"])
                                        for (var i ){
                                            console.log(newData[i])
                                            //console.log(i)
                                            document.getElementById(i).innerHTML=newData[i];
                                            }*/

				                    var show = shengcheng();
				                    document.write(show);

                                    function shengcheng() {
                                        var show = ""
                                        var num=0;
                                        show += ("<table cellspacing=' "+0+" ' border=' "+1+" '>");
                                        show += ("<tr>")
                                        show += ("<th rowspan=' 2 '  >探针ID</th>")
                                        show += ("<th colspan=' 20000 ' >腐蚀速率相关曲线</th>")//5000个id
                                        show += ("</tr>")
                                        for (var i in newData) {
                                            show += ("<tr align='"+'center'+"'>")
                                            for (var j in newData[i]) {
                                                    show += ("<td colspan='"+3+"'>")
                                                    show += ("探头"+j)
                                                    show += ("</td>")
                                                    show += ("<td colspan='"+1+"'>")
                                                    show += ("")
                                                    show += ("</td>")
                                                    num++;
                                            }
                                            show += ("</tr>")
                                            break;
                                        }
                                        show += (("<tr align='"+'center'+"'>"))
                                        for(var i=0;i<num;i++){
                                            show += ("<th><input type='"+'checkbox'+"'  name='"+'cb'+i+"' onclick='"+'if(this.checked==true){toSelect(true,this.name);}else{toSelect(false,this.name);}'+"'></th>")
                                            show += ("<th>MV</th><th>AV</th><th>VF</th>")

                                        }
                                        show += ("</tr>")

                                        var length=Object.keys(newData).length;
                                        for (var i=0;i<length;i++) {
                                            a="COM"+i;
                                            //console.log(Object.keys(newData)[i]);
                                            //a=Object.keys(newData)[i]
                                            show += (("<tr align='"+'center'+"'>"))
                                            var n1=0;
                                            for (var j in newData[a]) {
                                                    show += ("<td>"+newData[a][j]+"</td>")
                                                    show += ("<td><input type='"+'checkbox'+"'  name='"+'cb'+n1+"' ></td> <td><input type='"+'checkbox'+"'  name='"+'cb'+n1+"' ></td> <td><input type='"+'checkbox'+"'  name='"+'cb'+n1+"' ></td>")
                                                    show += ("</td>")
                                                    n1++;
                                            }
                                            show += ("</tr>")
                                        }
                                        show += ("</table>");
                                        show += ("<button onclick=Summit("+num+") style='"+'width:500px;height:50px;'+"' id='"+'Summit'+"'>提交</button>");
                                        return show;
                                    }


                                }

                           }
                       )
                    //},10000)
                })


    </script>
  <table cellspacing="0" width="1450" border="1">
        <tr>
            <th rowspan="2" width="300">探针ID</th>
            <th colspan="7" width="1150">腐蚀速率相关曲线</th>
        </tr>
        <tr align="center">
            <th colspan="3" width="450">探针ID-1</th>
            <th width="250"></th>
            <th colspan="3" width="450">探针ID-2</th>
        </tr>
<!--        <tr align="center">-->
<!--            <th></th>-->
<!--            <th colspan="3" width="450">腐蚀速率</th>-->
<!--            <th colspan="3" width="450">腐蚀深度</th>-->

<!--        </tr>-->

        <tr align="center">
            <th></th>
            <th>1</th>
            <th>2</th>
            <th>3</th>
            <th></th>
            <th>1</th>
            <th>2</th>
            <th>3</th>
        </tr>
        <tr align="center">
            <th><input type="checkbox"  name="cb1" onclick="if(this.checked==true){toSelect1(true);}else{toSelect1(false);}"></th>
            <th>MV</th>
            <th>AV</th>
            <th>VF</th>
            <th><input type="checkbox"  name="cb2" onclick="if(this.checked==true){toSelect2(true);}else{toSelect2(false);}"></th>
            <th>MV</th>
            <th>AV</th>
            <th>VF</th>
        </tr>
        <tr align="center">
            <td id="COM0">1</td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
        </tr>
        <tr align="center">
            <td id="COM1">1</td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
        </tr>
        <tr align="center">
            <td id="COM2">2</td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
        </tr>
        <tr align="center">
            <td id="COM3">3</td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
        </tr>
        <tr align="center">
            <td id="COM4">4</td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
        </tr>
        <tr align="center">
            <td id="COM5">5</td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
        </tr>
        <tr align="center">
            <td id="COM6">6</td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
        </tr>
        <tr align="center">
            <td id="COM7">7</td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
        </tr>
        <tr align="center">
            <td id="COM8">8</td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
        </tr>
        <tr align="center">
            <td id="COM9">9</td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
        </tr>
        <tr align="center">
            <td id="COM10">10</td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
        </tr>
        <tr align="center">
            <td id="COM11">11</td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
        </tr>
        <tr align="center">
            <td id="COM12">12</td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
        </tr>
        <tr align="center">
            <td id="COM13">13</td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
        </tr>
        <tr align="center">
            <td id="COM14">14</td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
        </tr>
        <tr align="center">
            <td id="COM15">15</td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
        </tr>
        <tr align="center">
            <td id="COM16">16</td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>

        </tr>
        <tr align="center">
            <td id="COM17">17</td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
        </tr>
        <tr align="center">
            <td id="COM18">18</td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
        </tr>
        <tr align="center">
            <td id="COM19">19</td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>

        </tr>
        <tr align="center">
            <td id="COM20">20</td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>

        </tr>
        <tr align="center">
            <td id="COM21">21</td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>

        </tr>
        <tr align="center">
            <td id="COM22">22</td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>

        </tr>
        <tr align="center">
            <td id="COM23">23</td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>

        </tr>
        <tr align="center">
            <td id="COM24">24</td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>

        </tr>
        <tr align="center">
            <td id="COM25">25</td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>

        </tr>
        <tr align="center">
            <td id="COM26">26</td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>

        </tr>
        <tr align="center">
            <td id="COM27">27</td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>

        </tr>
        <tr align="center">
            <td id="COM28">28</td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
        </tr>
        <tr align="center">
            <td id="COM29">29</td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
        </tr>
        <tr align="center">
            <td id="COM30">30</td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
        </tr>
        <tr align="center">
            <td id="COM31">31</td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
        </tr>
        <tr align="center">
            <td id="COM32">32</td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td><input type="checkbox"  name="cb1" ></td>
            <td></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
            <td><input type="checkbox"  name="cb2" ></td>
        </tr>

    </table>
  <center><button onclick=Summit() style="width:500px;height:50px;" id="Summit">提交</button></center>

</body>
</html>